import Koa from "koa";
import { python2Fig as python2 } from "./python2";
import { python3Fig as python3 } from "./python3";
import { javascript2Fig as javascript } from "./javascript";

const langKeysFigs = {
  python2,
  python3,
  javascript,
};

const handlerGenerator = (key: string) => {
  return async (
    ctx: Koa.ParameterizedContext<Koa.DefaultState, Koa.DefaultContext, any>
  ) => {
    ctx.response.body = {
      keyword: langKeysFigs[key as keyof typeof langKeysFigs].keywords,
    };
  };
};

export { langKeysFigs, handlerGenerator };
